package filetest.filewriter;
/*Alex Lorenzo 
 In a future implementation a better interface will be used, but for proof of 
 concept the CLI will have to do for now. Future plans include persisting to a
 DB. */


import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Scanner;
public class Main {
  
    public static void menuDisplay(){
        System.out.println("*************************************MAIN MENU*************************************");
        System.out.println("Please Enter a menu item listed below followed by enter/return.                   *");
        System.out.println("1. Display Current Date and Time                                                  *");
        System.out.println("2. Display Processesor Core Total                                                 *");
        System.out.println("3. Set Cores manually (CORE X 4THREADS)                                           *");
        System.out.println("4. Display number of threads performing writes.                                   *");
        System.out.println("dD.Redisplay Menu                                                                 *");
        System.out.println("xX.Exit                                                                           *");
        System.out.println("***********************************************************************************");
    }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
            // TODO Auto-generated method stub
            Scanner userinput = new Scanner(System.in);
            boolean mainloop = true;
            String dir = "";
            Path directory = null;
            
            char menuselection;
            System.out.println("Disk Benchmarking Utility, Please provide the\n"
                    + "name of a directory to test, do not end with a '/': ");
            dir = userinput.next();
            directory = Paths.get(dir);
            menuDisplay();
            if (!Files.isDirectory(directory)){
                System.out.println("You Have entered an Invalid directory Pat"
                        + "h");
                System.exit(1);
            }
            if (!Files.isWritable(directory)){
                System.out.println("Your User: " + System.getProperty
                        ("user.name") + " does not have write access.");
                System.exit(2);
            }
           
  
            System.out.println(Runtime.getRuntime().availableProcessors());
            FileWriter test = new FileWriter ("/Users/alorenzo");
	    System.out.println(FileWriter.getRandomCharacterString(10).length());
	    System.out.println(FileWriter.getRandomCharacterString(23));
	    System.out.println(FileWriter.getRandomCharacterString(24));
	    System.out.println(test.getDateTime());
            FileWriterThreadObj test2 = new FileWriterThreadObj(test);
            System.out.println(test2.getFileToWrite());
            Thread t = new Thread(new FileWriterThreadObj(test), "My Thread");
            t.start();
	}
	
}
